package models

import (
	"gorm.io/gorm"
)

type Order struct {
	gorm.Model
	UserID  int64
	OrderSn string
	GoodsId int64
	Num     int64
	Total   float64
	Status  string `gorm:"type:int(1);default:0;comment:0-待支付 1-已支付"`
}

func (o *Order) Create() error {
	return DB.Create(o).Error
}

func (o *Order) GetOrderById() error {
	return DB.Where("id = ?", o.ID).Limit(1).Find(&o).Error
}
